function cantor(x1,y1,x2,y2,k)
x=[x1,x2];
y=[y1,y2];
subplot(2,3,k)
hold on
plot(x,y,'k')
hold off
ay1=(y2-y1)/3+y1;
ay2=y2-(y2-y1)/3;
k=k-1;
if k>0
cantor(x1,y1,0,ay1,k);
cantor(0,ay2,x2,y2,k);
end